package top.ywlog.permission.config;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
import top.ywlog.permission.interceptor.HttpInterceptor;

/**
 * @author: Durian
 * @date: 2020/10/18 0:12
 * @description:
 */
@Configuration
public class WebAppConfig implements WebMvcConfigurer
{
    @Autowired
    private HttpInterceptor httpInterceptor;

    private static final String PATTERN = "/**";

    @Override
    public void addInterceptors(InterceptorRegistry registry)
    {
        WebMvcConfigurer.super.addInterceptors(registry);
        registry.addInterceptor(httpInterceptor).addPathPatterns(PATTERN);
    }
}
